package classes.form {
	import classes.Label;

	import flash.display.Sprite;

	/**
	 * @author dennyshess
	 */
	public class SliderControler extends Sprite {

		private var label : Label;
		private var image : *;

		public function SliderControler(image : *) : void {
			this.mouseChildren = false;
			this.buttonMode = true;
			this.image = image;
			createController();
		}

		private function createController() : void {
			var Controller : Sprite = new Sprite();
			trace( this.image );
			if( this.image ) {
				Controller.addChild(this.image);
			} else {
				Controller.graphics.beginFill(0x00FF00);
				Controller.graphics.drawRect(0, 0, 20, 20);
				Controller.graphics.endFill();
			}			
			Controller.x = 2;
			this.addChild(Controller);
			
			this.label = new Label("0");
			this.label.generate(9, 0xFFFFFF, false, 20);
			this.label.x = Math.round((this.width / 2 - this.label.width / 2))+4;
			this.label.y =2;
			this.addChild(this.label);
		}

		public function updateLabel( text : * ) : void {
			this.label.updateText(text);
		}
	}
}
